﻿Imports System
Imports System.Collections
Imports System.ComponentModel

Namespace System.Workflow.ComponentModel.Design
    Friend Class TypePropertyValueProviderTypeConverter
        Inherits TypePropertyTypeConverter
        ' Methods
        Public Overrides Function GetStandardValues(ByVal context As ITypeDescriptorContext) As StandardValuesCollection
            Dim provider As IPropertyValueProvider = Nothing
            Dim instance As Object() = [TryCast](context.Instance,Object())
            If ((Not instance Is Nothing) AndAlso (instance.Length > 0)) Then
                provider = [TryCast](instance(0),IPropertyValueProvider)
            Else
                provider = [TryCast](context.Instance,IPropertyValueProvider)
            End If
            Dim values As ICollection = New Object(0  - 1) {}
            If ((Not provider Is Nothing) AndAlso (Not context Is Nothing)) Then
                values = provider.GetPropertyValues(context)
            End If
            Return New StandardValuesCollection(values)
        End Function

        Public Overrides Function GetStandardValuesExclusive(ByVal context As ITypeDescriptorContext) As Boolean
            Return True
        End Function

        Public Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
            Return True
        End Function

    End Class
End Namespace

